<template>
<div class="grxx_grxx-low">
    <div class="grxx-low_1">
        个人信息
    </div>
    <!-- 分割线利用背景色 -->
    <div class="grxx-low__"></div> 
    <div class="grxx-low_2">
        <div class="grxx-low_2_1">
          <div class="grxx-low_lab">上传头像：</div>
            <el-upload
                class="avatar-uploader"
                action="https://jsonplaceholder.typicode.com/posts/"
                :show-file-list="false"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload">
                <img v-if="imageUrl" :src="imageUrl" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                <div class="grxx-low_2_1_2">上传</div>
            </el-upload>
            <div class="grxx-img">
              <div class="grxx-img-head"></div>
              <div class="grxx-img-title">
                预览图
                <i class="el-icon-zoom-in" style="position:relative;top:4px"></i>
              </div>
            </div>
        </div>
        <div class="grxx-low_2_2">建议上传图片尺寸为60px*60px，若不设置则使用系统默认头像</div>
          <div style="margin:30px;"></div>
            <el-form :rules="rules" ref="formLabelAlign" :label-position="labelPosition" label-width="150px" :model="formLabelAlign">
              <el-form-item style="margin-bottom:14px" label="邮箱地址"  required="true" prop="email">
                <el-input  placeholder="该邮箱将作为客服人员的登录帐号" v-model="formLabelAlign.email"></el-input>
              </el-form-item>
              <el-form-item style="margin-bottom:14px" label="客服昵称" required="true"  prop="name" >
                <el-input placeholder="与外部客户沟通时使用" v-model="formLabelAlign.name"></el-input>
              </el-form-item>
              <el-form-item style="margin-bottom:14px" label="真实姓名" required="true"   prop="username">
                <el-input placeholder="请输入" v-model="formLabelAlign.username"></el-input>
              </el-form-item>
              <el-form-item style="margin-bottom:14px" label="客服工号">
                <el-input v-model="formLabelAlign.number" placeholder="请输入"></el-input>
              </el-form-item>
              <el-form-item style="margin-bottom:14px" label="客服手机号码">
                <el-input v-model="formLabelAlign.tele" placeholder="请输入"></el-input>
              </el-form-item>
            </el-form>
        <!-- 分割线利用背景色 -->
       <div class="grxx-low__1"></div>
      </div> 
      <div class="grxx-low_3">
          <div class="grxx-low_3_1">密码设置</div>
            <div style="margin:20px;"></div>
            <el-form :label-position="labelPosition" label-width="150px" :model="formLabelAlign" :rules="rules" ref="formLabelAlign" >
             <el-form-item style="margin-bottom:14px" label="原密码" required="true" prop="newpass">
                <el-input type="password" v-model="formLabelAlign.new_pass" autocomplete="off"  placeholder="请输入原密码"></el-input>
              </el-form-item>
              <el-form-item style="margin-bottom:14px" label="新密码" required="true" prop="newpass">
                <el-input type="password" v-model="formLabelAlign.new_pass" autocomplete="off"  placeholder="请输入新密码"></el-input>
              </el-form-item>
              <el-form-item style="margin-bottom:14px" label="确认新密码" required="true" prop="snewpass">
                <el-input type="password" v-model="formLabelAlign.snew_pass" autocomplete="off" placeholder="请再次输入密码"></el-input>
              </el-form-item>
              <el-form-item>
                <div class="grxx_1232" @click="submitForm('ruleForm')">
                  <!-- <el-button type="primary" >保存</el-button> -->
                  <my-button :color="true">保存</my-button>
                </div>
              </el-form-item>
            </el-form>
          <div class="grxx-low__2"></div>
        </div>
        <!-- 分割线利用背景色 -->
    

</div>
</template>

<script>
import MyButton from '@/components/MyInput/MyButton'
  export default {
    components:{
      MyButton
    }
,
    data: function() {
    
      return {
        imageUrl: '',
        labelPosition: 'left',
        formLabelAlign: {
          // email:'123456789@qq.com',
          // name:'客服小美',
          // username: '杜宇',
          email:'',
          name:'',
          username: '',
          number: '',
          tele: '',
          pass:'',
          new_pass:'',
          snew_pass:'',
        },

        rules: {
          email:[
            { required: true, message: '邮箱地址不能为空', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          name:[
            { required: true, message: '客服昵称不能为空', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          username:[
            { required: true, message: '真实姓名不能为空', trigger: 'blur' },
            { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
          ],
          pass:[
            { required: true, message: '密码不能为空', trigger: 'blur' },
           
          ],
          newpass:[
            { required: true, message: '密码不能为空', trigger: 'blur' },
          ],
         snewpass:[
            { required: true, message: '密码不能为空', trigger: 'blur' },
          ],
          
          },
      };

    },
    methods: {
      handleAvatarSuccess(res, file) {
        this.imageUrl = URL.createObjectURL(file.raw);
      },
      beforeAvatarUpload(file) {
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;

        if (!isJPG) {
          this.$message.error('上传头像图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传头像图片大小不能超过 2MB!');
        }
        return isJPG && isLt2M;
      },
     submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
  
    },
     
  }
</script>

<style >
.grxx_grxx-low {
  width: 1040px;
  height: 849px;
  background-color: #ffffff;
} 
/* 上传头像 */
.grxx_grxx-low .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overfgrxx-low: hidden;
  }
  .grxx_grxx-low .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .grxx_grxx-low .grxx-low_2{
    position: relative;
    left: 65px;
  }
  .grxx_grxx-low .grxx-low_2_1{
    width: 100%;
    height: 104px;
    display:flex;
    color: rgba(153, 153, 153, 0.847);
    font-size: 14px;
  }
  .grxx_grxx-low .grxx-low_lab{
    /* position: absolute; */
    /* text: 160px; */
    width: 150px;
    height: 40px;
  } 
  .grxx_grxx-low .grxx-low_img{
    width: 104px;
    height: 104px;
    border:dotted ;
    border-radius: 4px;
    
  }
  .grxx_grxx-low .grxx-low_imgs{ 
    width: 26px;
    height: 26px;
    /* background-image: url("./u327.png");  */
    background-size: cover;
    /* background-blend-mode: lighten; */
    background-color: #0000ff;
    border-radius: 50%;
    background-position: center;
    background-repeat: no-repeat;

  }
 
  .grxx_grxx-low .avatar-uploader{
    
    background-color:#f2f2f2;
    /* border-style: dashed; */
 
  }
   
  .grxx_grxx-low .avatar-uploader-icon {
    
    font-size: 24px;
    color: #8c939d;
    width: 104px;
    height: 84px;
    position: relative;
    top: 30px;
    text-align: center;
    
    /* line-height: 150px; */

  }
  .grxx_grxx-low .grxx-low_2_1_2{
    font-size: 14px;
    position: relative;
    top: -10px;
  }
  .grxx_grxx-low .grxx-low_2_2{
    color: rgba(153, 153, 153, 0.847);
    font-size: 12px;
    position: relative;
    left: 150px;
    top: 14px;

  }
  .grxx_grxx-low .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
  .grxx_grxx-low .grxx_grxx-low{
    
    width: 1040px;
    height: 849px;
    border-width: 0px;
    background-color: rgba(255, 255, 255, 1);
    border-radius: 4px;
  }
  .grxx_grxx-low .grxx-low_1{
    width: 100%;
    height: 60px;
    position: relative;
    top: 15px;
    left: 20px;
    font-size: 18px;
    font-family:ArialMT, Arial, sans-serif;
    font-style:normal;
    font-weight:400;
  }
  .grxx_grxx-low .grxx-low__{
    position: relative;
    left: 20px;
    width: 1020px;
    height: 1px;
    background-color:rgba(153, 153, 153,0.5);
    margin-bottom: 15px;
  }
  .grxx_grxx-low .el-form.el-form--label-left{
    width: 800px;
    margin: 0;
    padding: 0;
    
  }
  .grxx_grxx-low .el-form-item{
    width: 500px;
    height: 48px;
    
    
    }
  .grxx_grxx-low .el-form-item label{
    color: rgba(153, 153, 153, 0.847);
    font-size: 14px;

  }
  
 /* input[type=text]{
   width: 330px;
   height: 40px;
   background-color: rgba(242, 242, 242,0.5);
   border: none;
 }
 input[type=text]:focus{
   background-color: white;
   border-style: solid;
   border-color: blue;
   border-width: 1px;
   
 } */
 
 
 .grxx_grxx-low .el-input{
    font-family: 'Helvetica', sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 12px;
    color: #000000;
    
  }
  .grxx_grxx-low .grxx-low__1{
    width: 962px;
    height: 1px;
    background-color:rgba(153, 153, 153,0.5);
    margin-bottom: 15px;
  }
  
  .grxx-low_3{
    position: relative;
    left: 65px;
  }
  .grxx-low_3_1{
    width: 56px;
    height: 19.2px;
    font-size: 14px;
  }
  .grxx-low__2{
    width: 962px;
    height: 1px;
    background-color:rgba(153, 153, 153,0.5);
    margin-bottom: 15px;

  }
  .grxx_grxx-low .grxx-low_4{
    position: relative;
    left: 65px;
  }
  
  
  .grxx_grxx-low .grxx-low_4  /deep/ .el-button{
    width: 80px;
    height: 32px;
    color: white;
    background-color:#4d79ff;
    border: none;
    font-size: 16px;
    line-height: 0;
    margin-left: 10px;
  }
  /* .grxx_grxx-low .el-button:hover{
    color: white;
    background-color:#4d79ff;
    border: none;
    font-size: 16px;
    line-height: 0;
  } */

  .grxx_1232{
    position: relative;
    left: -150px;
  }

  .grxx-img{
    width: 104px;
    height: 104px;
    border-radius: 4px;
    border: 1px dashed lightgrey;
    margin-left: 15px;
  }

  .grxx-img-head{
    width: 48px;
    height: 48px;
    background-color: #006eff;
    border-radius: 50%;
    margin: 10px 30px;
  }

  .grxx-img-title{
    height: 48px;
    width: 104px;
    margin: 0 30px;
    padding-top: 5px;
    display: flex;
  }
</style>